<template>
  <van-sidebar v-model="activeKey" dot = true>
  <van-sidebar-item :title="name" v-for = "name in list"  :key = "name" @click = "leap(name)"/>
 </van-sidebar>
</template>

<script>
import axios from '@/Utils/server';
export default {
  name:"categorysidebar-vue",
  data() {
    return {
      activeKey: 0,
      list:[]
    };
  },
  created(){
    axios.get("/api/pro/categorylist")
    .then(list=>{
        if(list.data.code == 200){
            console.log(this.activeKey);
                this.list = list.data.data

        }
        
    })
    this.$parent.brandname = "手机"
    axios.get("/api/pro/categorybrandlist",{
        params:{
          category:"手机"
        }
      })
      .then(res=>{
        this.$parent.brandname = res.data.data
      })
  },
  methods:{
    leap(n){
      this.$parent.categoryname =n
      axios.get("/api/pro/categorybrandlist",{
        params:{
          category:n
        }
      })
      .then(res=>{
        this.$parent.brandname = res.data.data
      })
    }
  }
}
</script>

<style>

</style>